<?php
namespace app\index\controller;
use think\Controller;
use acextend\send;
use think\Db;
use think\Cache;
class ConButtClik extends Base
{
    public function CacheDel()
    {
            $ReportCount = Model('Common')->getReportCreateNow();
            cache('ReportCount',NULL);
            return show('200','操作成功',$ReportCount);
    }


    public function Outgoing()
    {
        $data = Db::query("SELECT * FROM S_SampleDetail  A INNER JOIN S_SampleItem B ON A.ID = B.S_SampleId 
        WHERE  S_SampleTime BETWEEN  '2021-03-04'    AND '2021-03-10' AND A.yqdh = '外包标本'  and  S_shosiptal = '杭州千麦' and outhosiptal !='杭州千麦'
        ");
        if($data){
            $this->assign('data',$data);
            return $this->fetch('extra/outgoing');
        }
    }

    /***
     *   外送单位检索  --by time
     */
    public function OutgoingBytime($S_SampleTime)
    {
        $S_SampleTime = $_GET['S_SampleTime'];
        $S_SampleTimeafter = date("Y-m-d",strtotime("+1 day",strtotime($S_SampleTime)));
        $data = Db::query("SELECT * FROM S_SampleDetail  A INNER JOIN S_SampleItem B ON A.ID = B.S_SampleId 
        WHERE  S_SampleTime BETWEEN  :S_SampleTime    AND  :S_SampleTimeafter AND A.yqdh = '外包标本'   and  S_shosiptal !=  outhosiptal
        ",['S_SampleTime'=>$S_SampleTime,'S_SampleTimeafter'=>$S_SampleTimeafter]);

        if($data){
            return layshow('0','success',20, $data);
        }
        return layshow('0','error',20, $data);
    }

}